package com.imooc.utils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.omg.CORBA.OBJECT_NOT_EXIST;

/**
 * 功能描述: <br>
 * (Json工具类)
 *
 * @Author:Mr. xyb
 * @Date: 2018/5/18 17:23
 * @since: 1.8.0
 * @version: 1.0.0
 */
public class JsonUtils {

    /**
     * 对象转换为json字符串
     * @param object
     * @return
     */
    public static String toJson(Object object) {
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setPrettyPrinting();
        Gson gson = gsonBuilder.create();
        return gson.toJson(object);
    }
}
